<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>主机维护</title>
	<%@ include file="/WEB-INF/include/include.jsp" %>
	<script type="text/javascript" src="<%=path %>/js/rms/vmmgr/VMMgr.js"></script>
  </head>
  <body>
  		<div class="listpage-locked-content">
			<h2 class="listpage-lk-title" >主机维护</h2>
			<div class="listpage-lk-search" id="searchWrap" ></div>
			<div class="listpage-lk-tbar" id="tbarWrap"></div>
		</div>
		
		<div class="listpage-content">
			<div class="listpage-grid" id="gridWrap"></div>
		</div>
		
  </body>
</html>

	<ui:page>

  	<ui:model name="GridVMModel">
  		 <x:attr name="fields" type="array">
  		 	<ui:model.field name="VM_ID"   ></ui:model.field>
  		 	<ui:model.field name="VDC_Name"   ></ui:model.field>
  			<ui:model.field name="VApp_Name"  ></ui:model.field>
  			<ui:model.field name="VM_Name"   ></ui:model.field>
  			<ui:model.field name="VM_Status"  ></ui:model.field>
  			<ui:model.field name="VM_Cpu" ></ui:model.field>
  			<ui:model.field name="VM_Memory"   ></ui:model.field>
  			<ui:model.field name="VM_HardDisk"   ></ui:model.field>
  			<ui:model.field name="VM_Netcards"   ></ui:model.field>
  			
  		</x:attr>
  	</ui:model>
	
	<ui:quicksearch handler="VMList.quickSearch" scope="VMList" renderTo="searchWrap"></ui:quicksearch>
	<ui:b_toolbar menuCode="VMMgr" id="toolbar"  renderTo="tbarWrap" />
	
	<ui:grid id="VMGrid" showCheckbox="true" autoLoad="false"
		datasetName="VMMgrDatasetHandler" 
		handlerName="VMMgrQueryHandler" 
		model="GridVMModel" renderTo="gridWrap"  >
		<x:columns>
			<ui:gridcolumn dataIndex="VM_ID" hidden="true" ></ui:gridcolumn>
			<ui:gridcolumn text="云中心名称" dataIndex="VDC_Name"/>
			<ui:gridcolumn text="项目名称" dataIndex="VApp_Name"/>
			<ui:gridcolumn text="主机名称" dataIndex="VM_Name"/>
			<ui:gridcolumn text="状态" dataIndex="VM_Status" renderer="VMList.statusRender" />
			<ui:gridcolumn text="CPU" dataIndex="VM_Cpu"/>
			<ui:gridcolumn text="内存" dataIndex="VM_Memory"/>
			<ui:gridcolumn text="硬盘大小" dataIndex="VM_HardDisk"/>
			<ui:gridcolumn text="网卡数" dataIndex="VM_Netcards"/>
			
		</x:columns>
		<x:listeners>
			<x:handler name="itemclick" funcName="VMList.fillHostForm"></x:handler>
		</x:listeners>
	</ui:grid>
	<x:bottomScript> 
	if(VMList.dataset!=undefined)
	Ext.getCmp("VMGrid").getStore().add(VMList.dataset.record);
	</x:bottomScript>
	
	<ui:searchform id="VMSearchForm">
		<x:items>
			<ui:formPanel.text id="VM_NAME" fieldLabel="名称包含" config="true"></ui:formPanel.text>
			<ui:formPanel.comboxstatic id="VM_STATUS" fieldLabel="状态" data="[['1','启用'],['0','禁用']]" config="true"></ui:formPanel.comboxstatic>
		</x:items>
	</ui:searchform>
	<ui:advSearchWindow searchFormId="VMSearchForm" id="advSearchWin" 
	searchHandlerscope="VMList" searchHandler="VMList.advSearch" 
	height="200" width="300"/>
	
	<ui:window  id="hostConfigWin"  width="500" height="300">
		<x:attr name="layout" type="string">border</x:attr>
		<x:attr name="closeAction">hide</x:attr>
		<x:items>
			<ui:formPanel id="hostForm"  >
				<x:attr name="region" type="string">center</x:attr>
				<x:attr name="fieldDefaults">
					<x:value>
						<x:attr name="labelAlign"  type="string" >right</x:attr>
						<x:attr name="width"  type="int" >400</x:attr>
					</x:value>
				</x:attr>
				<x:items>
					<ui:formPanel.text  id="configId"  config="true"  hidden="true"  />
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
						<ui:formPanel.number id="cups" fieldLabel="CPU个数"  config="true" allowBlank="false" width="200" ></ui:formPanel.number>
						</x:attr>
					</x:value>			
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.number id="memory" fieldLabel="内存大小"  allowBlank="false" config="true" width="200" ></ui:formPanel.number>
							<ui:formPanel.comboxstatic id="fmemoryunit" fieldLabel="单位" allowBlank="false" data="[['0','MB'],['1','GB']]" width="200" value="1"  config="true">
							</ui:formPanel.comboxstatic>
						</x:attr>
					</x:value>					
					<x:value>
						<x:attr name="padding" type="string">2</x:attr>
						<x:attr name="layout">column</x:attr>
						<x:attr name="border" type="int" >0</x:attr>
						<x:attr name="items" type="array">
							<ui:formPanel.number id="storage" fieldLabel="硬盘大小"  allowBlank="false" config="true" width="200"  ></ui:formPanel.number>
							<ui:formPanel.comboxstatic id="fstorageunit" fieldLabel="单位" allowBlank="false" data="[['0','MB'],['1','GB'],['2','TB']]"  value="1" width="200"  config="true">
							</ui:formPanel.comboxstatic>
						</x:attr>
					</x:value>
				</x:items>
			</ui:formPanel>
		</x:items>
		<x:attr name="buttons">
			<x:array>
				<ui:button text="确定" handler="VMList.modifyHostParams" />
				<ui:button text="取消" handler="VMList.closeHostWin"/>
			</x:array>
		</x:attr>
	</ui:window>
		
	
	
	
	
	</ui:page>

	
